<template>
  <view>
    <z-paging ref="paging" style="padding-bottom: 60px" v-model="dataList" :safe-area-inset-bottom="true" :auto-show-back-to-top="true" :use-page-scroll="false" @query="queryList">
      <view slot="top">
        <view class="radius text-center padding-xs bg-white">
          <view class="text-left margin-left-xs">订单号：{{ orderno }}</view>
          <view class="text-left margin-left-xs margin-top-xs">提交时间：{{ countda.create_time }}</view>
          <view class="flex margin-xs">
            <view class="flex-sub text-left">
              <text class="text-gray">总提面额</text>
              <text class="text-price text-orange margin-left-sm">{{ countda.money }}</text>
            </view>
            <view class="flex-sub text-left">
              <text class="text-gray">总结算金额</text>
              <text class="text-price text-green margin-left-sm">{{ parseFloat(countda.amount).toFixed(2) }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="radius bg-white solid-bottom margin-top-sm" v-for="(item, index) in dataList" :key="index">
        <view class="cu-bar col-2" style="min-height: 60rpx">
          <view class="action">
            <text>{{ item.bsLei.title }}</text>
          </view>
          <view class="action">
            <text class="text-green" v-if="item.status == 2">处理成功</text>
            <text class="text-pink" v-else-if="item.status < 2">处理中</text>
            <text class="text-mauve" v-else-if="item.status == 3">处理失败</text>
            <text class="text-brown" v-else>审核中</text>
          </view>
        </view>
        <view class="padding-sm text-gray text-sm" style="padding-top: 0">
          <view class="flex">
            <view class="flex-sub text-left margin-xs">
              面值:
              <text class="text-orange margin-left-sm">{{ item.money }}</text>
            </view>
            <view class="flex-sub margin-xs text-right">
              结算:
              <text class="text-price text-bold text-green text-df margin-left-sm">{{ parseFloat(item.amount).toFixed(2) }}</text>
            </view>
          </view>
          <view class="text-left margin-xs margin-bottom-sm text-df">
            卡号:
            <text class="text-black">{{ item.card_no }}</text>
          </view>
          <view class="text-left margin-xs margin-bottom-sm text-df">
            卡密:
            <text class="text-black">{{ item.card_key }}</text>
          </view>
          <view class="text-left margin-xs">
            备注：
            <text class="text-pink">{{ item.remarks }}</text>
          </view>
          <view class="text-xs text-left margin-left-xs margin-top-sm" v-if="item.status < 2">处理时间：--</view>
          <view class="text-xs text-left margin-left-xs margin-top-sm" v-else>处理时间：{{ item.chulitime }}</view>
        </view>
      </view>
    </z-paging>
  </view>
</template>
<script>
export default {
  data() {
    return {
      orderno: null,
      dataList: [],
      countda: { money: 0, amount: 0 }
    };
  },
  onLoad(ops) {
    if (ops.orderno == null || ops.orderno == undefined) {
      uni.showToast({
        title: '参数错误',
        position: 'bottom',
        icon: 'none',
        success: function () {
          setTimeout(function () {
            uni.navigateBack({
              delta: 1
            });
          }, 1100);
        }
      });
    }
    this.orderno = ops.orderno;
  },
  methods: {
    queryList(pageNo, pageSize) {
      const params = {
        pageNo: pageNo,
        pageSize: pageSize,
        orderno: this.orderno
      };
      var that = this;
      uni.request({
        method: 'post',
        url: that.app.apiHost + '/selldetailinfo',
        header: { Authorization: 'bearer ' + that.app.getAuthCode() },
        data: params,
        success: (data) => {
          if (data.data.code == -1) {
            that.app.showMsg('请登陆后再操作!', '../login/login');
          }
          let list = data.data.data;
          console.log(list);
          that.countda = data.data.data.count;
          that.$refs.paging.complete(list.data.data);
        },
        fail(a) {
          that.$refs.paging.complete(false);
        }
      });
    }
  }
};
</script>

<style>
page {
  background-color: #f1f1f1;
}
</style>
